// index.js
// 获取应用实例
const app = getApp()

Page({
  data: {
    infor:"",
    list:[],
    status:''
  },

  bindInput(e){
    // console.log(e);
    this.data.infor = e.detail.value
  },
  add(e){
    // console.log(e);
    console.log(this.data.infor);
    if(this.data.infor===''){

      wx.showToast({
        title: '内容不能为空',
        icon: 'error',
  
      })
      return
    }
    let obj = {
      infor:this.data.infor,
      status:false,
      id:new Date().getTime()
    }

    this.data.list.push(obj)
   
    this.setData({
      list:this.data.list,
      infor:''
      
    })
  },
  cut(e){

    console.log(e);
    let index = e.currentTarget.dataset.index
    let status = e.currentTarget.dataset.status
    console.log(e.currentTarget.dataset.status);
    this.data.list[index].status = !e.currentTarget.dataset.status
    this.setData({
      list:this.data.list
    })
    console.log();
    // console.log(status);
  },
  del(e){
    // console.log(e.currentTarget.dataset.i);
    let i = e.currentTarget.dataset.i
    this.data.list.splice(i,1)
    this.setData({
      list:this.data.list
    })
  }
})
